<!--  -->
<template>
  <div class="search-system-download-list">
    <el-form :inline="true" :model="search" class="demo-form-inline" @submit.native.prevent>
      <el-form-item label="内容检索">
        <el-input v-model="search.keyword" maxlength="100" placeholder="输入内容" size="small" style="width:300px;"></el-input>
      </el-form-item>

      <el-form-item style="margin-left:12px;">
        <el-button type="primary" @click="onSubmit" size="small">查询</el-button>
        <el-button type="success" @click="onReset" size="small">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    search: {
      type: Object
    },
    resetData: {
      type: Function
    },
    reset: {
      type: Function
    }
  },
  created () {
    let query = this.$route.query
    if (!query || !query.sid) {
      this.$message.error('未能获取到正确的数据')
      return
    }
    let systemId = query.sid
    // 获取系统信息
    this.$post('/system/info', { id: systemId }).then((resoponse) => {
      if (resoponse && resoponse.id) {
        this.system = resoponse
      }
    })
  },
  data () {
    return {
      // 当前的系统
      system: {}
    }
  },
  methods: {
    onSubmit () {
      this.resetData({ page: 1 })
    },
    onReset () {
      this.reset()
      this.$nextTick(() => {
        this.onSubmit()
      })
    }
  }
}

</script>
<style scoped>
.search-system-download-list /deep/ .el-form-item {
  margin-bottom: 8px;
}
</style>
